package com.wyp.demo.exception;

/**
 * @author: Oliver
 * @time: 2020/11/5/6:52
 */
public class Excepetion1 {
    public static void main(String[] args) {
        System.out.println(getNum());
    }

    /**
     * 返回结果为2,想要得到的结果为1,实际结果为2
     * 不要再finally块中进行return语句.
     *
     * @return
     */
    public static int getNum() {
        int i = 0;
        try {
            return ++i;
        } finally {
            return ++i;
        }
    }
}
